package com.happy.xiao.common.rabbitmq.service.impl;

import com.happy.xiao.common.rabbitmq.service.INormalMessage;
import com.happy.xiao.common.rabbitmq.service.IReliabilityMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;

/**
 * 普通类型的消息发送管理
 */
@Service("NormalMessageService")
public class NormalMessageImpl implements INormalMessage {

    @Autowired
    private Environment env;

    @Autowired
    IReliabilityMessage iReliabilityMessage;

    @Override
    public boolean sendSimpleMessage(String message, String callbackURL) throws Exception {
        String exchange = env.getProperty("simple.mq.exchange.name");
        String routingKey = env.getProperty("simple.mq.routing.key.name");

        return iReliabilityMessage.sendReliabilityNormalMessage(exchange, routingKey, message, callbackURL, 5000);
    }

}
